package com.sasis.webapp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.acegisecurity.Authentication;
import org.acegisecurity.ui.logout.LogoutHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ClearSessionLogoutHandler implements LogoutHandler {
	
	private static final Log log = LogFactory.getLog(ClearSessionLogoutHandler.class);
	
	public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
		HttpSession session = request.getSession();
		if (session != null) {
			session.removeAttribute("functionsTree");
			log.debug("logout -> remove functionsTree from session!");
		}
	}

}
